]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
lookingGlass: Also handle null objects in objectToString
authorJonas Dreßler <verdre@v0yd.nl>
Wed, 19 Feb 2020 10:53:05 +0000 (11:53 +0100)
committerJonas Dreßler <verdre@v0yd.nl>
Wed, 19 Feb 2020 10:56:36 +0000 (11:56 +0100)
Whoops, while ff4623454 fixed the handling of `undefined` objects,
`null` objects obviously still don't have a toString() method. So also
handle those and return 'null' in case the object is null.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1024

js/ui/lookingGlass.js

index 54e3e48581e4c624e9ed889019be7315c7ce7723..ed0186cc2fe82042d8b7ebba704dcf5140c6f01c 100644 (file)
@@ -244,7 +244,13 @@ function objectToString(o) {
         // special case this since the default is way, way too verbose
         return '<js function>';
     } else {
-        return o !== undefined ? o.toString() : 'undefined';
+        if (o === undefined)
+            return 'undefined';
+
+        if (o === null)
+            return 'null';
+
+        return o.toString();
     }
 }